MODULE intro2;


(*-----------------by yoa, 27 maart/2april-------------------------*)



<* NOOPTIMIZE + *>  (* For the Debugger *)

    FROM IO IMPORT WrStr, WrBool,WrLn, RdCard,KeyPressed, WrCard, RdInt, WrInt, RdKey, RdLn;     (* import general procedures *)

    FROM Lib IMPORT Delay,Speaker;
   (* FROM Graph IMPORT Init, Rectangle, Circle,Line, Disc,RawOutText;
  FROM Graph IMPORT _clrBLACK, _clrBLUE, _clrGREEN, _clrCYAN, _clrRED, _clrMAGENTA;
  FROM Graph IMPORT _clrBROWN, _clrWHITE, _clrGRAY, _clrLIGHTBLUE, _clrLIGHTGREEN;
  FROM Graph IMPORT _clrLIGHTCYAN, _clrLIGHTRED, _clrLIGHTMAGENTA, _clrLIGHTYELLOW, _clrBRIGHTWHITE;
  (* FROM StandardSound IMPORT SoundEventEn, InitSound, PlaySoundEvent; *)
  FROM StandardBitmap2 IMPORT BITMAP_SIZE, DIGIT_SIZE, BitmapEn, DrawBitmap, DrawNumber, DrawDigit, DrawBitmapFile, DrawSavedBitmap; *)
  FROM RealMath IMPORT sqrt;
  FROM StandardLib IMPORT Arrow, TestColours, AngleWithXAx, DegreesToRadians, RadiansToDegrees, RotatePoint, RdArrowKey;
  FROM StandardSound IMPORT SoundEventEn, InitSound, PlaySoundEvent;
  (*FROM StandardMouse IMPORT InitMouseGraphWindow, UpdateMouse, GetMouseY, GetMouseX, MouseButton, IsButtonPressed; *)
  FROM Windows IMPORT VK_UP, VK_DOWN,VK_LEFT, VK_RIGHT,VK_SPACE,VK_ESCAPE,VK_NUMLOCK;
  FROM Wimdows IMPORT Window, KillWindow, UpdateWindow, (*GetSize,*) SetTitle,TextInt,
                    SetBuffering, ClearScreen, RgbColor, Line,  Rectangle, Disc, Arc,Polygon,
                    Text, SetFont, KeyDown, MousePos, MouseLeft, MouseRight, FlushKeys,
		    OnMouseLeft, OnMouseRight, OnMouseDouble, StopOnMouseLeft,
		    StopOnMouseRight, StopOnMouseDouble,LoadBitmap,  DrawBitmap,
		    _clrBLACK,_clrGRAY,_clrWHITE,_clrBROWN,_clrMAGENTA,_clrBLUE,
		    _clrGREEN,_clrRED,_clrLIGHTYELLOW,_clrCYAN, _clrBRIGHTWHITE,
		    _clrLIGHTBLUE, _clrLIGHTRED, _clrLIGHTGREEN,_clrLIGHTCYAN;
CONST

	SCREENSIZE_HOR = 700;
        SCREENSIZE_VERT = 700;
	SIZECIRKEL = 13;	
VAR	

kangsignID,monsterID,yoaID,tomID,nilsID,heroID,menuID,Beginx,Beginy:CARDINAL;
width,hight: CARDINAL;
monsterIDr, monsterIDl : INTEGER;
Key : INTEGER;
bool : BOOLEAN;


PROCEDURE DISTANCE(eenx,eeny,tweex,tweey:INTEGER):INTEGER;
    VAR dis: INTEGER;
    BEGIN
    dis:= (eenx-tweex)*(eenx-tweex)+(eeny-tweey)*(eeny-tweey);
        RETURN dis;
   END DISTANCE;

PROCEDURE StartGame();
BEGIN
WrStr('game has been gestart door jou');
END StartGame;

PROCEDURE GoInStruct();            (* aangepast 2april *)
VAR delaytime:CARDINAL;
BEGIN
delaytime:=1000;
WrStr('here is instructomento');

ClearScreen;

SetFont( 2, _clrLIGHTBLUE );
Text('Om te bewegen, duwt up op...',100,400);
    Delay(delaytime);
SetFont( 2, _clrRED );
Text('pijltjestoets link of rechts!',350,400);
    Delay(delaytime);Delay(delaytime);
SetFont( 2, _clrLIGHTBLUE );

Text('Om te springen, duwt u op...',100,440);
    Delay(delaytime);
SetFont( 2, _clrRED );
Text('pijltjestoets naar boven!',350,440);
    Delay(delaytime);Delay(delaytime);
 SetFont( 2, _clrLIGHTBLUE );

Text('Om te schieten met je ultra-modern waterpistool duwt u op...',110,480);
    Delay(delaytime);
 SetFont( 2, _clrRED );

Text('de spatiebalk!',350,500);
    Delay(delaytime);Delay(delaytime);


Text('Veel speelplezier...',50,600);


Delay(500);
 StartGame();
		

END GoInStruct;

PROCEDURE Secret();                      (*aangepast 2april *)
BEGIN
WrStr(' amai das hier secret! ');
END Secret;

PROCEDURE muis(GetmouseX,GetmouseY:INTEGER);
 BEGIN
 bool:=FALSE;
 IF DISTANCE(GetmouseX,GetmouseY,Beginx+60,Beginy+35) < SIZECIRKEL*SIZECIRKEL  THEN
    Disc(Beginx+60,Beginy+35,SIZECIRKEL,_clrGREEN);
    GoInStruct;
    bool:=TRUE;

 ELSE
  Disc(Beginx+60,Beginy+35,SIZECIRKEL,_clrRED);
 END;

 IF DISTANCE(GetmouseX,GetmouseY,Beginx+60,Beginy+95) < SIZECIRKEL*SIZECIRKEL  THEN
     StartGame;
    bool:=TRUE;

 ELSE
  Disc(Beginx+60,Beginy+95,SIZECIRKEL,_clrRED);
 END;


 IF DISTANCE(GetmouseX,GetmouseY,SCREENSIZE_HOR+5-2*SIZECIRKEL,2*SIZECIRKEL) < SIZECIRKEL*SIZECIRKEL  THEN
    Disc(SCREENSIZE_HOR+5-2*SIZECIRKEL,2*SIZECIRKEL,SIZECIRKEL,_clrLIGHTBLUE);
     Secret;
    bool:=TRUE;

 ELSE
  Disc(SCREENSIZE_HOR+5-2*SIZECIRKEL,2*SIZECIRKEL,SIZECIRKEL,_clrBLACK);
 END;
 END muis;

PROCEDURE menubalk(beginx,beginy:CARDINAL);
VAR

bool:BOOLEAN;

BEGIN
  Beginx:=beginx;
  Beginy:=beginy;
 menuID:=LoadBitmap("menubalk.bmp", beginx, beginy );
 DrawBitmap(beginx, beginy,menuID);

  Disc(beginx+60,beginy+35,SIZECIRKEL,_clrRED);
  Disc(beginx+60,beginy+95,SIZECIRKEL,_clrRED);
  Disc(SCREENSIZE_HOR+5-2*SIZECIRKEL,2*SIZECIRKEL,SIZECIRKEL,_clrBLACK);
LOOP
Delay(10);


 OnMouseLeft(muis);
 IF bool THEN
 EXIT
 END;


END;


END menubalk;




BEGIN
 (* Initialise graphics
 (* IF NOT Init(1, 1 , SCREENSIZE_HOR+5, SCREENSIZE_VERT+5) THEN
    WrStr("Sorry, graphics doesn't work");WrLn;
    RETURN;
  END;   *)

  IF NOT InitMouseGraphWindow(SCREENSIZE_HOR+5, SCREENSIZE_VERT+5) THEN
    WrStr("Sorry, mouse & graphics doesn't work");WrLn;
    RETURN;
  END;    *)

(* Initialise game window *)
Window("Intro", SCREENSIZE_HOR, SCREENSIZE_VERT);
SetBuffering(TRUE);

(* Initialise sound system *)
IF InitSound(TRUE)=FALSE THEN
	WrStr("Sorry, sound doesn't work on this computer...");
	ELSE (*WrStr("Sound OK...")*);
END;
WrLn;

      bool:=FALSE;
  kangsignID := LoadBitmap(200, 200, "kangsign2.bmp", width, hight ); Rectangle(1,1,SCREENSIZE_HOR+5, SCREENSIZE_VERT+5,_clrBLACK,TRUE);
 DrawBitmap(200, 200, kangsignID);Delay(3000);
 Rectangle(1,1,SCREENSIZE_HOR+5, SCREENSIZE_VERT+5,_clrBLACK,TRUE);

    Text(20,300,_clrGREEN,'A game produced by:');
    Delay(2500);
    Text(200,320,_clrGREEN,'Yoachim aka Erstobalio'); yoaID:=LoadBitmap(57, 57, "onbekendman1.bmp", width, hight );
    Delay(1000);
    Text(200,340,_clrGREEN,'Tom aka Stom'); tomID:=LoadBitmap(293, 58, "tom.bmp", width, hight ); DrawBitmap(293,58,tomID);
    Delay(1000);
    Text(200,360,_clrGREEN,'Nils aka Zatte Fischtik'); nilsID:=LoadBitmap(527, 59, "onbekendman3.bmp", width, hight );
    Delay(1000);
    Text(210,400,_clrLIGHTBLUE,'We proudly present you...');
    Delay(1500);
    Text(300,420,_clrRED,'Our Hero...');
    monsterIDl:=LoadBitmap(54, 520, "kangoeroelinks2.bmp", width, hight ); Delay(100);  monsterIDr:=LoadBitmap(54, 520, "kangoeroerechts2.bmp", width, hight );
    Delay(1000);
    Text(300,440,_clrRED,'In Zijn Avontuur');Delay(500);Text(430,440,_clrRED,'.');Delay(500);Text(430+5,440,_clrRED,'.');Delay(600);Text(430+5+5,440,_clrRED,'.');Delay(700);Text(430+5+5,440,_clrRED,'.');
    Delay(900);
    Text(335,480,_clrRED,'De Jacht Op Het Ei...');
    Delay(1500);

    menubalk(300,550);

    Delay(3000);






END intro2.